package com.lamada.demo;

import com.lamada.common.Person;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class demo {

    public static void main(String[] args) {
        List<Person> personList = new ArrayList<>();
        personList.add(new Person("test", 23));
        personList.add(new Person("test", 24));
        Map<String, Person> map= new HashMap<String, Person>();
        personList.forEach(item->{
            map.put(item.getName(), item);
        });
        map.forEach((key, value)->{
            System.out.println("--------");
            System.out.println(key);
            System.out.println(value.toString());
        });

//        Map<String, Person> collect = personList.stream().collect(Collectors.toMap(Person::getName, item->item));
//        collect.forEach((key, value)->{
//            System.out.println("--------");
//            System.out.println(key);
//            System.out.println(value.toString());
//        });


    }
}
